Page({
 
  data: {
    getAllDoctorApi: "http://dashui.nat300.top/MedicalFollowUpSystem/doctor/getDoctors",
    getDoctorByIdApi: "http://dashui.nat300.top/MedicalFollowUpSystem/doctor/getDoctors",
    doctorList:{},
    doctorInfo:{},
    isShowInfo: false
  },

  getDoctorId(e) {
    var index = e.currentTarget.dataset.index;
    this.data.doctorInfo = this.data.doctorList[index];
  },

  getDoctorInfo:function(){
    var that = this
    wx.request({
      url: that.data.getDoctorByIdApi,
      data: {"id": index},
      method: "GET",
      success: function(res) {
        that.setData({
          doctorInfo: res.data
        })
        console.log(doctorInfo);
      },
      fail: function(err) {
        console.log("hihi");
        console.log(err);
      }
    })
  },

  toGetInfo:function(){
    this.setData({
      isShowInfo: !this.data.isShowInfo,
    });
  },

  getDoctorList: function() {
    var that = this
    wx.request({
      url: that.data.getAllDoctorApi,
      data: {"id": 1},
      method: "GET",
      success: function(res) {
        that.setData({
          doctorList: res.data
        })
        console.log(doctorList);
      },
      fail: function(err) {
        console.log("hihi");
        console.log(err);
      }
    })
  },

  reverse:function(){
    wx.showModal({
      title: '请注意！',
      content: '您前面有1位患者正在问诊，是否确定预约？',
      complete: (res) => {
        if (res.cancel) {
          
        }
        if (res.confirm) {
          wx.navigateTo({
            url: '/pages/orders/orders',
          })
        }
      }
    })
   },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    this.getDoctorList()
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})